/**
 * 类型添加
 * @param exports
 * @returns
 */
layui.define(['common','api','form','layer'],function(exports){
	var $ = layui.jquery;
	var form = layui.form();
	var layer = layui.layer;

	var api = layui.api;
	var common = layui.common;

	//监听提交
  	form.on('submit(formDemo)', function(data){
		api.addType(data.field,function(res){
			if(res.status == 200){
				layer.alert(res.msg, {
		          icon: 1,
		          end:function(){
		          	location.href = '/blog/back/type';
		          }
		    });
			} else {
				common.error(res);
			}
		});
		return false;
  	});

	exports('type-add',{});
});